/*
 * @Author: your name
 * @Date: 2020-08-11 11:47:30
 * @LastEditTime: 2020-08-12 18:24:17
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /topline-admin-yezi/src/api/article.js
 */
/**
 * 封装用户相关操作
 *
 * es6按需导入导出
 */
// ajax名字是可以改的。它的格式与 axios()的格式是一样的
import ajax from '../utils/request.js'
//  定义一个函数，并导出

// 添加文章
export const addArticle = (data, params) => {
  return ajax({
    method: 'POST',
    url: '/mp/v1_0/articles',
    data,
    params
  })
}

// 获取频道list
export const getChannelList = () => {
  return ajax({
    method: 'get',
    url: '/mp/v1_0/channels'
  })
}
// 获取资源库图片
export const getSource = params => {
  return ajax({
    method: 'get',
    url: '/mp/v1_0/user/images',
    params
  })
}
// 获取文章
export const getArticleById = id => {
  return ajax({
    method: 'get',
    url: `/mp/v1_0/articles/${id}`
  })
}
